<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>北京联合大学</title>
</head>
<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.3.7/dist/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<!-- <link rel="stylesheet" href="https://at.alicdn.com/t/font_835526_xufba1hg66.css"> -->
<link rel="stylesheet" href="https://at.alicdn.com/t/font_835526_uzbxo9d25is.css">
<link rel="stylesheet" href="../../css/Initialization.css">
<link rel="stylesheet" href="../../css/commen.css">
<link rel="stylesheet" href="../../css/teamcontribution.css">
<body>
<div id="content">
    <div class="initer">
            <!-- 具体内容 -->
        <div class="bread">
            <div class="plain" th:text="${menu.menuname}">成立公司</div>
            <div class="plain">
                <i class="iconfont icon-right"></i>
            </div>
            <div class="plain current"><a th:text="${smenu.menuname}" th:href="@{basicslist(mid=${menu.id},sid=${smenu.id},gradeid=${content.gradeid})}">单元知识点</a></div>
            <div class="plain">
                <i class="iconfont icon-right"></i>
            </div>
            <div class="plain current" th:text="${smenu.menuname}+'管理'">单元知识点</div>
        </div>
            <div class="teamteamcontribution">
                <input type="hidden" id="id" name="id" th:value="${content.id}">
                <input type="hidden" id="mid" name="mid" th:value="${menu.id}"/>
                <input type="hidden" id="sid" name="sid" th:value="${smenu.id}"/>
                <input type="hidden" id="gradeid" name="gradeid" th:value="${content.gradeid}"/>
                <div id="editor" placeholder="请输入详细内容" th:utext="${content.detail}"></div>
            </div>
            <div class="button">
                <div class="center-button boxshow" id="subBut">保存</div>
                <!--div class="center-button boxshow">返回</div-->
            </div>
        </div>
</div>
<script src="../../js/jquery-3.4.1.min.js"></script>
<script src="../../js/commen.js"></script>
<script src="../../js/wangEditor.js"></script>
<script>
    var editor;
    window.onload = function(){
        // 富文本编辑器
        var E = window.wangEditor;
        editor = new E('#editor');
        // 或者 var editor = new E( document.getElementById('editor') )
        editor.create()
    };
    $(function(){
        $("#subBut").click(function(){
            var id = $("#id").val();
            var mid = $("#mid").val();
            var sid = $("#sid").val();
            var gradeid = $("#gradeid").val();
            var title ="";
            var detail = editor.txt.html();
            var attachments = "";
            var sort = 0;
            if(detail.length == 0){
                alert("请输入详细内容");
                $("#detail").focus();
                return false;
            }else{
                $.ajax({
                    type : "POST",
                    url : "toadd",
                    data : {id:id,mid: mid,sid: sid,gradeid:gradeid,sort:sort, title: title, detail: detail, attachments: attachments},
                    dataType : "json",
                    success : function(json) {
                        if(json.state == error){
                            alert(json.result);
                        }else{
                            alert("编辑成功");
                            history.back();
                        }
                    },
                    error:function(msg){
                        alert("程序出错，请联系管理员");
                    }
                });
            }
        });
    });
</script>
</body>
</html>

